//
//  TieDeatailCell0.m
//  Car
//
//  Created by dllo on 15/10/31.
//  Copyright © 2015年 岳明. All rights reserved.
//

#import "TieDeatailCell0.h"
#import "MJRefresh.h"
#import "TieDeatailViewController.h"

#define WIDTH [UIScreen mainScreen].bounds.size.width
#define HEIGHT [UIScreen mainScreen].bounds.size.height

@interface TieDeatailCell0 ()<UIWebViewDelegate>

@property (nonatomic, strong) UIWebView *web;
@property (nonatomic, retain) UIActivityIndicatorView *activ;



@end

@implementation TieDeatailCell0

- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        self.web = [[UIWebView alloc]initWithFrame:CGRectMake(0, 0, WIDTH, self.contentView.frame.size.height)];
        self.web.backgroundColor = [UIColor whiteColor];
//        self.contentView.backgroundColor = [UIColor redColor];
        [self.contentView addSubview:self.web];

        self.web.delegate = self;
        self.activ = [[UIActivityIndicatorView alloc]initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];
        self.activ.center = self.contentView.center;
        [self.contentView addSubview:self.activ];
        [self.activ startAnimating];
        


    }
    return self;
}



- (void)setDiscuss:(YZLDiscuss *)discuss {
    if (_discuss != discuss) {
        _discuss = discuss;
    }
    NSString *urlStr = [NSString stringWithFormat:@"http://a.xcar.com.cn/interface/6.0/bbs_detail.php?tid=%@&themeType=white&network=wifi&deviceType=iOS&type=0&version=6.2.3&fontSize=normal&p=1", _discuss.postId];
    NSURL *url = [NSURL URLWithString:urlStr];
    NSURLRequest *request = [NSURLRequest requestWithURL:url];
    [self.web loadRequest:request];

}












//开始加载
//-(void)webViewDidStartLoad:(UIWebView *)webView
//{
//    [self.activ startAnimating];
//}

//加载完成
-(void)webViewDidFinishLoad:(UIWebView *)webView
{
    [self.activ stopAnimating];
}



@end
